<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// 获取活动列表
Route::get("game/list","api\GameController@list");
Route::get("game/join/{gameId}","api\GameController@join");


Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

// 搜索场馆
Route::post("venue/search","api\VenueController@search");

// 获取场馆列表
Route::get("venue/list","api\VenueController@list");


// 产生模拟数据
Route::get("venue/test","api\VenueController@test");
Route::get("venue/order_list","api\VenueController@order_list");


// 获取指定栏目下的场馆列表
Route::get("venue/list/{typeId}","api\VenueController@venues");

// 获取场馆详情
Route::get("venue/detail/{venueId}","api\VenueController@detail");

// 获取所有栏目
Route::get("venue/types","api\VenueController@types");

// 获取时段价格列表
Route::get("venue/time_prices/{venue_id}","api\VenueController@date_sn_time_prices");

// 测试路由
Route::get("venue/test","api\VenueController@test");

// 保存订单
Route::post("order/save","api\OrderController@save");


// 用户注册
Route::post("user/reg","api\UserController@reg");

// 用户登录
Route::post("user/login","api\UserController@login");

// 保存头像
Route::post("user/save_icon","api\UserController@save_icon");

Route::get("user/test","api\UserController@test");


// 只有登录用户才能访问的路由 -- 后台路由拦截

Route::group(['middleware' => ['auth.api']], function () {

    Route::get('/test', function () {
        return 'test';
    });
    // 关注场馆
    Route::get("venue/follow/{id}","api\VenueController@follow");
    // 取消关注
    Route::get("venue/unfollow/{id}","api\VenueController@unfollow");
    Route::post("game/save","api\GameController@save");

    // 删除活动
    Route::get("game/del/{gameId}","api\GameController@del");

    // 用户创建的活动
    Route::get("user/create_games","api\UserController@create_games");

    Route::get("user/join_games","api\UserController@join_games");

    // 发布朋友圈

    Route::post("friend/upload","api\FriendController@upload");
    Route::post("friend/save","api\FriendController@save");

});


Route::get('/demo', function () {
    return 'demo';
});

